/**
 * Created by ROCK on 2017/12/20.
 */
(function () {
    'use strict';

    angular
        .module('news.center.controller', [])
        .controller('NewsCenterCtrl',NewsCenterCtrl);

    NewsCenterCtrl.$inject = ['$scope','$yikeUtils','$state','$ionicHistory','$ionicModal','$ionicTabsDelegate','localStorageService'];
    /* @ngInject */
    function NewsCenterCtrl($scope,$yikeUtils,$state,$ionicHistory,$ionicModal,$ionicTabsDelegate,localStorageService) {
        $scope.user = localStorageService.get('user');
        $scope.activeStatu = '';
        init();
        function init() {
            checkStatus();
        }
        //获取全部新闻列表
        function checkStatus(){
            yikeTaishan.newsLists('')
                .then(function (data) {
                    console.log(data);
                    $scope.newData = data.result.list;
                    console.log($scope.newData);
                    $scope.$digest();
                });
        }
        //获取新闻中心列表
        $scope.getNewLists = getNewLists;
        function getNewLists(type){
            $scope.activeStatu = type;
            yikeTaishan.newsLists(type)
                .then(function (data) {
                    console.log(data);
                    $scope.newData = data.result.list;
                    console.log($scope.newData);
                    $scope.$digest();
                });

        }


    }
})();
